// Alternate Realms Main File
// Copyright 2006 Mike Behlen

// System includes
#include <iostream>     // Basic C++ I/O header
#include <string>       // Defines std::string
#include <stdlib.h>     // Some Linux-specific things such as rand()

using namespace std;

// Class definitions
#include "logic.hh"     // Defines the Logic object and Plan list
#include "item.hh"      // Defines the Item object and Inventory list
#include "person.hh"    // Defines the Person object and Crowd list
#include "place.hh"     // Defines the Place object

// Initialization / Loading headers
#include "commands.hh"  // Loads Logic commands into the default Plan
#include "pcparty.hh"   // Loads Person objects into the default Crowd

// Function Declarations
#include "formlists.hh" // Prints out things prettily

int main () {
  // Most of these define the logic for the things you type
  Plan *commands = new Plan ();
  readCommandsInto(commands);

  // Loads the people in your party
  Crowd *party = new Crowd;
  readPartyInto(party);

  string usrcmd = "";
  short reac = 0;
  string reacParam = "";
  while (1) {
    cout << "> ";
    usrcmd = "";
    cin >> usrcmd;
    reac = commands->getReaction(TYPE, usrcmd);
    reacParam = commands->getReactionParameter(TYPE, usrcmd);
    switch (reac) {
    case PRINT:
      cout << reacParam << "\n";
      break;
    case SHOWINVENTORY:
      // This segfaults because of a bug in showInventory(Inventory)
      showInventory(party->getPerson_order(0));
      break;
    case EXIT:
      cout << "Exiting.\n";
      return 0;
    case NOTHING:
      cout << "Unknown Command.\n";
      break;
    }
  }
}
